package day20;

import java.util.Scanner;

/**
 * @author tongchen
 * @create 2023-03-27 19:45
 */
public class Main1 {
    public static void main(String[] args) {
        //创建输入
        Scanner scanner=new Scanner(System.in);
        String s1=scanner.nextLine();
        String s2=scanner.nextLine();
        //创建二维数组
        int maxSize=0;
        int[][]arr=new int[s1.length()+1][s2.length()+1];
        for(int i=1;i<=s1.length();++i){
            for(int j=1;j<=s2.length();++j){
                if(s1.charAt(i-1)==s2.charAt(j-1)){
                    arr[i][j]=arr[i-1][j-1]+1;
                    if(arr[i][j]>maxSize){
                        maxSize=arr[i][j];
                    }
                }
            }
        }
        System.out.println(maxSize);
    }
}
